import Vue from 'vue';
import Router from 'vue-router';
import HelloWorld from '@/components/Home';
import L from '../components/List';
import N from '../components/News';
import A from '../components/About';
import D from '../components/Detail';
import B from '../components/Books';

Vue.use(Router);

export default new Router({
  routes: [
    {
      path: '/',
      name: 'Home',
      component: HelloWorld,
    }, {
      path: '/List', // 页面中url里面显示的地址信息
      name: 'List', // 路由名字，可以随便写，但是不能重名
      component: L, // 组件名字
      children: [ // 子路由
        { name: 'Books', path: 'books/:type', component: B }, // path中type传递的是地址信息
      ],
    }, {
      path: '/News',
      name: 'News',
      component: N,
    }, {
      path: '/About',
      name: 'About',
      component: A,
    }, {
      path: '/Detail',
      name: 'Detail',
      component: D,
    },
  ],
});
